<?php
    //$this->Paginator->options(array('url' => array('ext' => false, '?' => $this->request->query)));
?>
<div id="content-header">
    <h1>
        <a href="/admin/node/node_types">NodeType</a> / <?php echo __d('system','Management List Term');?></h1>    
</div>
<div class="container-fluid">
    <div class="row-fluid">
     <div class="span12">    
    <?php echo $this->element('toolbar');?>
    <?php echo $this->Form->create('Paginate', array('id' => 'paginate', 'url' => $this->request->here(false), 'type' => 'post', 'inputDefaults' => array('label' => false))); ?>                                            
        <div class="widget-box widget-content-no-padding">
            <!--For manage node normal-->
                <div class="widget-content  widget-content-two">
                
                <table class="table table-bordered data-table table-striped wd-hover-btn">
                    <thead>
                        <tr>
                            <th><?php echo  __d('system', 'Id'); ?>      </th>
                            <th> <?php echo  __d('system', 'Name'); ?></th>
                            <th> <?php echo  __d('system', 'Created'); ?></th>
                            <th class="wd-fix-width">  <?php echo  __d('system', 'Translate'); ?></th>
                            <th class="wd-fix-width"><?php echo  __d('system', 'Action'); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $defaultLanguage = Router::defaultLanguage();
                        $_queries = array('continue' => $this->request->here(false));
                        ?> 
                            <?php foreach ($listTerms as $term) : ?>                                            
                        <tr>
                                    
                        <?php if (isset($_displayFields['id'])): ?>       
                            <td>
                                <?php echo $term['Term']['id']; ?>
                           </td>
                           <?php endif; ?>
                        <?php if (isset($_displayFields['name'])): ?>       
                           <td>
                                <?php echo $term['Term']['name']; ?>
                           </td>
                        <?php endif; ?>
                        <?php if (isset($_displayFields['created'])): ?>       
                            <td>
                                <?php echo date("d-m-Y",$term['Term']['created']); ?>
                           </td>
                        <?php endif; ?>
                        <td>
                        <?php if (isset($_translateMaps)): ?>
                            <ul class="wd-laguage">
                                    <?php
                                    foreach (Configure::read('Languages') as $_language) {
                                        if ($_language['code'] === $defaultLanguage) {
                                            continue;
                                        } ?>
                                        <?php 
                                            if(empty($_language['path'])){
                                                $flags = 'flags_default.png';                                                
                                            }
                                            else{$flags = $_language['path'];}                                                                                        
                                        ?>
                            <li><?php  echo $this->Html->link($this->Html->image('/img/' .$flags), array('action' => 'translate', $term['Term']['id'], $_language['code'], '?' => $_queries), array(
                                    'class' => isset($_translateMaps[$term['Term']['id']][$_language['locale']]) ? '' : 'ui-state-disabled', 'escape' => false, 'title' => $_language['name']));?></li>           
                                    <?php }?>
                                    </ul>
                        <?php endif; ?>       
                        <td>
                            <ul class="wd-link-control">
                                <li><a href="<?php echo $this->Html->url(array('action' => 'edit',$type_id, $term['Term']['id'], $term['Term']['parent_id'], '?' => $_queries)); ?>" class="btn btn-mini"><i class="icon-edit"></i> <?php echo __d('system','Edit');?></a></li>
                                <li><a href="<?php echo $this->Html->url(array('action' => 'delete', '?' => array_merge($_queries, array('keys' => array($term['Term']['id'])))));?>"  class="btn btn-mini"><i class="icon-remove"></i> <?php echo __d('system','Delete');?></a></li>                            
                            </ul>
                            
                        </td>
                        </tr>                        
           <?php endforeach?>                        
                    </tbody>                         
                </table>
                                            
            </div>
            </div>
        </div>
    </div>    
</div>
<?php         
echo $this->Form->hidden('task', array('id' => 'task', 'value' => ''));
echo $this->Form->end();
?>